package com.huanwei.cc.activity;

import com.huanwei.cc.bean.ChengJi;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2019/5/15.
 */

public class JiSuan {
    static List<ChengJi.DataBean> buhege = new ArrayList<ChengJi.DataBean>();
    static List<ChengJi.DataBean> jige = new ArrayList<ChengJi.DataBean>();
    static List<ChengJi.DataBean> lianghao = new ArrayList<ChengJi.DataBean>();
    static List<ChengJi.DataBean> youxiu = new ArrayList<ChengJi.DataBean>();
    static List<String> iihe = new ArrayList<>();
    static String value = "" + 0;
    static String value1 = "" + 0;
    static String value2 = "" + 0;
    static String value3 = "" + 0;

    public static List<String> jisuan(List<ChengJi.DataBean> st) {
        buhege.clear();
        jige.clear();
        youxiu.clear();
        lianghao.clear();
        iihe.clear();
        for (int i = 0; i < st.size(); i++) {
            int zhi = Integer.parseInt(st.get(i).getAchievement());
            if (0 <= zhi && zhi < 59) {
                buhege.add(st.get(i));
            } else if (60 <= zhi && zhi < 75) {
                jige.add(st.get(i));
            } else if (75 <= zhi && zhi <= 85) {
                lianghao.add(st.get(i));
            } else if (85 <= zhi && zhi <= 100) {
                youxiu.add(st.get(i));
            }

        }

        if (buhege == null && buhege.size() == 0) {
            value = "" + 0;
        } else {
            value = "" + buhege.size();
        }

        if (jige == null && jige.size() == 0) {
            value1 = "" + 0;
        } else {
            value1 = "" + jige.size();
        }
        if (lianghao == null && lianghao.size() == 0) {
            value2 = "" + 0;
        } else {
            value2 = "" + lianghao.size();
        }
        if (youxiu == null && youxiu.size() == 0) {
            value3 = "" + 0;
        } else {
            value3 = "" + youxiu.size();
        }
        iihe.add(value);
        iihe.add(value1);
        iihe.add(value2);
        iihe.add(value3);
         return iihe;
    }
}
